#!/bin/sh

#
# Check that errors are framed
#

. "$(cd "$(dirname "$0")" && pwd)/common.sh"

EXPECTED_OUTPUT=$WORK/expected_output
ACTUAL_OUTPUT=$WORK/actual_output

cat >$EXPECTED_OUTPUT.type << EOF
ER
EOF

$FWUP_APPLY -i $FWFILE --list --framing > $ACTUAL_OUTPUT || true

# Verify and removing framing
cat $ACTUAL_OUTPUT | $FRAMING_HELPER -d > $ACTUAL_OUTPUT.noframing

# Check the type is "ER"
cat $ACTUAL_OUTPUT.noframing | (dd bs=1 count=2 2>/dev/null) > $ACTUAL_OUTPUT.type
diff -w $EXPECTED_OUTPUT.type $ACTUAL_OUTPUT.type
